import request from '@/utils/request'

// 查询返修领料列表
export function listRequisition(query) {
  return request({
    url: '/rr/requisition/list',
    method: 'get',
    params: query
  })
}

// 查询返修领料详细
export function getRequisition(orderId) {
  return request({
    url: '/rr/requisition/' + orderId,
    method: 'get'
  })
}

// 新增返修领料
export function addRequisition(data) {
  return request({
    url: '/rr/requisition',
    method: 'post',
    data: data
  })
}

// 修改返修领料
export function updateRequisition(data) {
  return request({
    url: '/rr/requisition',
    method: 'put',
    data: data
  })
}

// 删除返修领料
export function delRequisition(orderId) {
  return request({
    url: '/rr/requisition/' + orderId,
    method: 'delete'
  })
}

//执行出库
export function execute(orderId) {
  return request({
    url: '/rr/requisition/execute/' + orderId,
    method: 'get'
  })
}

//确认
export function confirmStatus(orderId) {
  return request({
    url: '/rr/requisition/confirmStatus/' + orderId,
    method: 'get'
  })
}
// 新增返修领料 连同单据体RrMaterialRequisitionLine一起添加
export function addRequisitionAndLine(data) {
  return request({
    url: '/rr/requisition/addAndLine',
    method: 'post',
    data: data
  })
}

// 修改返修领料 连同单据体RrMaterialRequisitionLine一起更新
export function updateRequisitionAndLine(data) {
  return request({
    url: '/rr/requisition/editAndLine',
    method: 'put',
    data: data
  })
}
/*================返修领料支领版   龙泉 ==========================*/

//确认 增加预占用
export function confirmStatusApplay(orderId) {
  return request({
    url: '/rr/requisition/confirmStatusApplay/' + orderId,
    method: 'get'
  })
}
// 删除其他出库
export function removeApplay(orderId) {
  return request({
    url: '/rr/requisition/removeApplay/' + orderId,
    method: 'delete'
  })
}
//支领版执行出库  解除预占用
export function executeApplay(orderId) {
  return request({
    url: '/rr/requisition/executeApplay/' + orderId,
    method: 'get'
  })
}
